gusucode.com > 231 - 红色婚纱 html66精品模板 > 231 - 红色婚纱/js/jquery.tools.min.js

    /*!
 * jQuery Tools v1.2.7 - The missing UI library for the Web
 * 
 * tabs/tabs.js
 * tabs/tabs.slideshow.js
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 */
(function(a) {
	a.tools = a.tools || {
		version: "v1.2.7"
	},
	a.tools.tabs = {
		conf: {
			tabs: "",
			current: "current",
			onBeforeClick: null,
			onClick: null,
			effect: "default",
			initialEffect: !1,
			initialIndex: 0,
			event: "click",
			rotate: !1,
			slideUpSpeed: 900,
			slideDownSpeed: 900,
			history: !1
		},
		addEffect: function(a, c) {
			b[a] = c
		}
	};
	var b = {
		"default": function(a, b) {
			this.getPanes().hide().eq(a).show(),
			b.call()
		},
		fade: function(a, b) {
			var c = this.getConf(),
			d = c.fadeOutSpeed,
			e = this.getPanes();
			d ? e.fadeOut(d) : e.hide(),
			e.eq(a).fadeIn(c.fadeInSpeed, b)
		},
		slide: function(a, b) {
			var c = this.getConf();
			this.getPanes().slideUp(c.slideUpSpeed),
			this.getPanes().eq(a).slideDown(c.slideDownSpeed, b)
		},
		ajax: function(a, b) {
			this.getPanes().eq(0).load(this.getTabs().eq(a).attr("href"), b)
		}
	},
	c,
	d;
	a.tools.tabs.addEffect("horizontal",
	function(b, e) {
		if (!c) {
			var f = this.getPanes().eq(b),
			g = this.getCurrentPane();
			d || (d = this.getPanes().eq(0).width()),
			c = !0,
			f.show(),
			g.animate({
				width: 0
			},
			{
				step: function(a) {
					f.css("width", d - a)
				},
				complete: function() {
					a(this).hide(),
					e.call(),
					c = !1
				}
			}),
			g.length || (e.call(), c = !1)
		}
	});
	function e(c, d, e) {
		var f = this,
		g = c.add(this),
		h = c.find(e.tabs),
		i = d.jquery ? d: c.children(d),
		j;
		h.length || (h = c.children()),
		i.length || (i = c.parent().find(d)),
		i.length || (i = a(d)),
		a.extend(this, {
			click: function(d, i) {
				var k = h.eq(d),
				l = !c.data("tabs");
				typeof d == "string" && d.replace("#", "") && (k = h.filter("[href*=\"" + d.replace("#", "") + "\"]"), d = Math.max(h.index(k), 0));
				if (e.rotate) {
					var m = h.length - 1;
					if (d < 0) return f.click(m, i);
					if (d > m) return f.click(0, i)
				}
				if (!k.length) {
					if (j >= 0) return f;
					d = e.initialIndex,
					k = h.eq(d)
				}
				if (d === j) return f;
				i = i || a.Event(),
				i.type = "onBeforeClick",
				g.trigger(i, [d]);
				if (!i.isDefaultPrevented()) {
					var n = l ? e.initialEffect && e.effect || "default": e.effect;
					b[n].call(f, d,
					function() {
						j = d,
						i.type = "onClick",
						g.trigger(i, [d])
					}),
					h.removeClass(e.current),
					k.addClass(e.current);
					return f
				}
			},
			getConf: function() {
				return e
			},
			getTabs: function() {
				return h
			},
			getPanes: function() {
				return i
			},
			getCurrentPane: function() {
				return i.eq(j)
			},
			getCurrentTab: function() {
				return h.eq(j)
			},
			getIndex: function() {
				return j
			},
			next: function() {
				return f.click(j + 1)
			},
			prev: function() {
				return f.click(j - 1)
			},
			destroy: function() {
				h.off(e.event).removeClass(e.current),
				i.find("a[href^=\"#\"]").off("click.T");
				return f
			}
		}),
		a.each("onBeforeClick,onClick".split(","),
		function(b, c) {
			a.isFunction(e[c]) && a(f).on(c, e[c]),
			f[c] = function(b) {
				b && a(f).on(c, b);
				return f
			}
		}),
		e.history && a.fn.history && (a.tools.history.init(h), e.event = "history"),
		h.each(function(b) {
			a(this).on(e.event,
			function(a) {
				f.click(b, a);
				return a.preventDefault()
			})
		}),
		i.find("a[href^=\"#\"]").on("click.T",
		function(b) {
			f.click(a(this).attr("href"), b)
		}),
		location.hash && e.tabs == "a" && c.find("[href=\"" + location.hash + "\"]").length ? f.click(location.hash) : (e.initialIndex === 0 || e.initialIndex > 0) && f.click(e.initialIndex)
	}
	a.fn.tabs = function(b, c) {
		var d = this.data("tabs");
		d && (d.destroy(), this.removeData("tabs")),
		a.isFunction(c) && (c = {
			onBeforeClick: c
		}),
		c = a.extend({},
		a.tools.tabs.conf, c),
		this.each(function() {
			d = new e(a(this), b, c),
			a(this).data("tabs", d)
		});
		return c.api ? d: this
	}
})(jQuery); (function(a) {
	var b;
	b = a.tools.tabs.slideshow = {
		conf: {
			next: ".forward",
			prev: ".backward",
			disabledClass: "disabled",
			autoplay: !1,
			autopause: !0,
			interval: 3e3,
			clickable: !0,
			api: !1
		}
	};
	function c(b, c) {
		var d = this,
		e = b.add(this),
		f = b.data("tabs"),
		g,
		h = !0;
		function i(c) {
			var d = a(c);
			return d.length < 2 ? d: b.parent().find(c)
		}
		var j = i(c.next).click(function() {
			f.next()
		}),
		k = i(c.prev).click(function() {
			f.prev()
		});
		function l() {
			g = setTimeout(function() {
				f.next()
			},
			c.interval)
		}
		a.extend(d, {
			getTabs: function() {
				return f
			},
			getConf: function() {
				return c
			},
			play: function() {
				if (g) return d;
				var b = a.Event("onBeforePlay");
				e.trigger(b);
				if (b.isDefaultPrevented()) return d;
				h = !1,
				e.trigger("onPlay"),
				e.on("onClick", l),
				l();
				return d
			},
			pause: function() {
				if (!g) return d;
				var b = a.Event("onBeforePause");
				e.trigger(b);
				if (b.isDefaultPrevented()) return d;
				g = clearTimeout(g),
				e.trigger("onPause"),
				e.off("onClick", l);
				return d
			},
			resume: function() {
				h || d.play()
			},
			stop: function() {
				d.pause(),
				h = !0
			}
		}),
		a.each("onBeforePlay,onPlay,onBeforePause,onPause".split(","),
		function(b, e) {
			a.isFunction(c[e]) && a(d).on(e, c[e]),
			d[e] = function(b) {
				return a(d).on(e, b)
			}
		}),
		c.autopause && f.getTabs().add(j).add(k).add(f.getPanes()).hover(d.pause, d.resume),
		c.autoplay && d.play(),
		c.clickable && f.getPanes().click(function() {
			f.next()
		});
		if (!f.getConf().rotate) {
			var m = c.disabledClass;
			f.getIndex() || k.addClass(m),
			f.onBeforeClick(function(a, b) {
				k.toggleClass(m, !b),
				j.toggleClass(m, b == f.getTabs().length - 1)
			})
		}
	}
	a.fn.slideshow = function(d) {
		var e = this.data("slideshow");
		if (e) return e;
		d = a.extend({},
		b.conf, d),
		this.each(function() {
			e = new c(a(this), d),
			a(this).data("slideshow", e)
		});
		return d.api ? e: this
	}
})(jQuery); (function(b) {
	b.tools = b.tools || {};
	b.tools.scrollable = {
		version: "1.1.2",
		conf: {
			size: 5,
			vertical: false,
			speed: 400,
			keyboard: true,
			keyboardSteps: null,
			disabledClass: "disabled",
			hoverClass: null,
			clickable: true,
			activeClass: "active",
			easing: "swing",
			loop: false,
			items: ".items",
			item: null,
			prev: ".prev",
			next: ".next",
			prevPage: ".prevPage",
			nextPage: ".nextPage",
			api: false
		}
	};
	var c;
	function a(o, m) {
		var r = this,
		p = b(this),
		d = !m.vertical,
		e = o.children(),
		k = 0,
		i;
		if (!c) {
			c = r
		}
		b.each(m,
		function(s, t) {
			if (b.isFunction(t)) {
				p.bind(s, t)
			}
		});
		if (e.length > 1) {
			e = b(m.items, o)
		}
		function l(t) {
			var s = b(t);
			return m.globalNav ? s: o.parent().find(t)
		}
		o.data("finder", l);
		var f = l(m.prev),
		h = l(m.next),
		g = l(m.prevPage),
		n = l(m.nextPage);
		b.extend(r, {
			getIndex: function() {
				return k
			},
			getClickIndex: function() {
				var s = r.getItems();
				return s.index(s.filter("." + m.activeClass))
			},
			getConf: function() {
				return m
			},
			getSize: function() {
				return r.getItems().size()
			},
			getPageAmount: function() {
				return Math.ceil(this.getSize() / m.size)
			},
			getPageIndex: function() {
				return Math.ceil(k / m.size)
			},
			getNaviButtons: function() {
				return f.add(h).add(g).add(n)
			},
			getRoot: function() {
				return o
			},
			getItemWrap: function() {
				return e
			},
			getItems: function() {
				return e.children(m.item)
			},
			getVisibleItems: function() {
				return r.getItems().slice(k, k + m.size)
			},
			seekTo: function(s, w, t) {
				if (s < 0) {
					s = 0
				}
				if (k === s) {
					return r
				}
				if (b.isFunction(w)) {
					t = w
				}
				if (s > r.getSize() - m.size) {
					return m.loop ? r.begin() : this.end()
				}
				var u = r.getItems().eq(s);
				if (!u.length) {
					return r
				}
				var v = b.Event("onBeforeSeek");
				p.trigger(v, [s]);
				if (v.isDefaultPrevented()) {
					return r
				}
				if (w === undefined || b.isFunction(w)) {
					w = m.speed
				}
				function x() {
					if (t) {
						t.call(r, s)
					}
					p.trigger("onSeek", [s])
				}
				if (d) {
					e.animate({
						left: -u.position().left
					},
					w, m.easing, x)
				} else {
					e.animate({
						top: -u.position().top
					},
					w, m.easing, x)
				}
				c = r;
				k = s;
				v = b.Event("onStart");
				p.trigger(v, [s]);
				if (v.isDefaultPrevented()) {
					return r
				}
				f.add(g).toggleClass(m.disabledClass, s === 0);
				h.add(n).toggleClass(m.disabledClass, s >= r.getSize() - m.size);
				return r
			},
			move: function(u, t, s) {
				i = u > 0;
				return this.seekTo(k + u, t, s)
			},
			next: function(t, s) {
				return this.move(1, t, s)
			},
			prev: function(t, s) {
				return this.move( - 1, t, s)
			},
			movePage: function(w, v, u) {
				i = w > 0;
				var s = m.size * w;
				var t = k % m.size;
				if (t > 0) {
					s += (w > 0 ? -t: m.size - t)
				}
				return this.move(s, v, u)
			},
			prevPage: function(t, s) {
				return this.movePage( - 1, t, s)
			},
			nextPage: function(t, s) {
				return this.movePage(1, t, s)
			},
			setPage: function(t, u, s) {
				return this.seekTo(t * m.size, u, s)
			},
			begin: function(t, s) {
				i = false;
				return this.seekTo(0, t, s)
			},
			end: function(t, s) {
				i = true;
				var u = this.getSize() - m.size;
				return u > 0 ? this.seekTo(u, t, s) : r
			},
			reload: function() {
				p.trigger("onReload");
				return r
			},
			focus: function() {
				c = r;
				return r
			},
			click: function(u) {
				var v = r.getItems().eq(u),
				s = m.activeClass,
				t = m.size;
				if (u < 0 || u >= r.getSize()) {
					return r
				}
				if (t == 1) {
					if (m.loop) {
						return r.next()
					}
					if (u === 0 || u == r.getSize() - 1) {
						i = (i === undefined) ? true: !i
					}
					return i === false ? r.prev() : r.next()
				}
				if (t == 2) {
					if (u == k) {
						u--
					}
					r.getItems().removeClass(s);
					v.addClass(s);
					return r.seekTo(u, time, fn)
				}
				if (!v.hasClass(s)) {
					r.getItems().removeClass(s);
					v.addClass(s);
					var x = Math.floor(t / 2);
					var w = u - x;
					if (w > r.getSize() - t) {
						w = r.getSize() - t
					}
					if (w !== u) {
						return r.seekTo(w)
					}
				}
				return r
			},
			bind: function(s, t) {
				p.bind(s, t);
				return r
			},
			unbind: function(s) {
				p.unbind(s);
				return r
			}
		});
		b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),
		function(s, t) {
			r[t] = function(u) {
				return r.bind(t, u)
			}
		});
		f.addClass(m.disabledClass).click(function() {
			r.prev()
		});
		h.click(function() {
			r.next()
		});
		n.click(function() {
			r.nextPage()
		});
		if (r.getSize() < m.size) {
			h.add(n).addClass(m.disabledClass)
		}
		g.addClass(m.disabledClass).click(function() {
			r.prevPage()
		});
		var j = m.hoverClass,
		q = "keydown." + Math.random().toString().substring(10);
		r.onReload(function() {
			if (j) {
				r.getItems().hover(function() {
					b(this).addClass(j)
				},
				function() {
					b(this).removeClass(j)
				})
			}
			if (m.clickable) {
				r.getItems().each(function(s) {
					b(this).unbind("click.scrollable").bind("click.scrollable",
					function(t) {
						if (b(t.target).is("a")) {
							return
						}
						return r.click(s)
					})
				})
			}
			if (m.keyboard) {
				b(document).unbind(q).bind(q,
				function(t) {
					if (t.altKey || t.ctrlKey) {
						return
					}
					if (m.keyboard != "static" && c != r) {
						return
					}
					var u = m.keyboardSteps;
					if (d && (t.keyCode == 37 || t.keyCode == 39)) {
						r.move(t.keyCode == 37 ? -u: u);
						return t.preventDefault()
					}
					if (!d && (t.keyCode == 38 || t.keyCode == 40)) {
						r.move(t.keyCode == 38 ? -u: u);
						return t.preventDefault()
					}
					return true
				})
			} else {
				b(document).unbind(q)
			}
		});
		r.reload()
	}
	b.fn.scrollable = function(d) {
		var e = this.eq(typeof d == "number" ? d: 0).data("scrollable");
		if (e) {
			return e
		}
		var f = b.extend({},
		b.tools.scrollable.conf);
		d = b.extend(f, d);
		d.keyboardSteps = d.keyboardSteps || d.size;
		this.each(function() {
			e = new a(b(this), d);
			b(this).data("scrollable", e)
		});
		return d.api ? e: this
	}
})(jQuery); (function(b) {
	var a = b.tools.scrollable;
	a.plugins = a.plugins || {};
	a.plugins.autoscroll = {
		version: "1.0.1",
		conf: {
			autoplay: true,
			interval: 3000,
			autopause: true,
			steps: 1,
			api: false
		}
	};
	b.fn.autoscroll = function(d) {
		if (typeof d == "number") {
			d = {
				interval: d
			}
		}
		var e = b.extend({},
		a.plugins.autoscroll.conf),
		c;
		b.extend(e, d);
		this.each(function() {
			var g = b(this).scrollable();
			if (g) {
				c = g
			}
			var i, f, h = true;
			g.play = function() {
				if (i) {
					return
				}
				h = false;
				i = setInterval(function() {
					g.move(e.steps)
				},
				e.interval);
				g.move(e.steps)
			};
			g.pause = function() {
				i = clearInterval(i)
			};
			g.stop = function() {
				g.pause();
				h = true
			};
			if (e.autopause) {
				g.getRoot().add(g.getNaviButtons()).hover(function() {
					g.pause();
					clearInterval(f)
				},
				function() {
					if (!h) {
						f = setTimeout(g.play, e.interval)
					}
				})
			}
			if (e.autoplay) {
				setTimeout(g.play, e.interval)
			}
		});
		return e.api ? c: this
	}
})(jQuery); (function(b) {
	var a = b.tools.scrollable;
	a.plugins = a.plugins || {};
	a.plugins.navigator = {
		version: "1.0.2",
		conf: {
			navi: ".navi",
			naviItem: null,
			activeClass: "active",
			indexed: false,
			api: false,
			idPrefix: null
		}
	};
	b.fn.navigator = function(d) {
		var e = b.extend({},
		a.plugins.navigator.conf),
		c;
		if (typeof d == "string") {
			d = {
				navi: d
			}
		}
		d = b.extend(e, d);
		this.each(function() {
			var i = b(this).scrollable(),
			f = i.getRoot(),
			l = f.data("finder").call(null, d.navi),
			g = null,
			k = i.getNaviButtons();
			if (i) {
				c = i
			}
			i.getNaviButtons = function() {
				return k.add(l)
			};
			function j() {
				if (!l.children().length || l.data("navi") == i) {
					l.empty();
					l.data("navi", i);
					for (var m = 0; m < i.getPageAmount(); m++) {
						l.append(b("<" + (d.naviItem || "a") + "/>"))
					}
					g = l.children().each(function(n) {
						var o = b(this);
						o.click(function(p) {
							i.setPage(n);
							return p.preventDefault()
						});
						if (d.indexed) {
							o.text(n)
						}
						if (d.idPrefix) {
							o.attr("id", d.idPrefix + n)
						}
					})
				} else {
					g = d.naviItem ? l.find(d.naviItem) : l.children();
					g.each(function(n) {
						var o = b(this);
						o.click(function(p) {
							i.setPage(n);
							return p.preventDefault()
						})
					})
				}
				g.eq(0).addClass(d.activeClass)
			}
			i.onStart(function(o, n) {
				var m = d.activeClass;
				g.removeClass(m).eq(i.getPageIndex()).addClass(m)
			});
			i.onReload(function() {
				j()
			});
			j();
			var h = g.filter("[href=" + location.hash + "]");
			if (h.length) {
				i.move(g.index(h))
			}
		});
		return d.api ? c: this
	}
})(jQuery);